class SyncWaterfallHook {
    constructor(...args) {
        this.tasks = [];
    }
    tap(name, task) {
        this.tasks.push(task);
    }
    call(...args) {
        const [first, ...other] = this.tasks;
        let result = first(...args);
        other.reduce((pre, next) => {
            let ret = next(pre);
            if (ret) return ret;
            return result;
        }, result);
    }
}

module.exports = SyncWaterfallHook;